<template>
  <view class="invoice-completed-page">
    <image class="page-bg" src="/static/images/bg.png" mode="aspectFill" />
    <view class="gradient-bg" :style="{ top: navBarHeight + 'px' }"></view>
    <CustomNavbar title="发票开具" />
    
    <view class="page-content" :style="{ paddingTop: navBarHeight + 'px' }">
      <!-- 成功状态 -->
      <view class="success-container">
        <view class="success-icon">
          <text class="checkmark">✓</text>
        </view>
        <text class="success-message">发票开具成功</text>
      </view>
      
      <!-- 底部按钮 -->
      <view class="button-group">
        <button class="return-btn" @click="handleReturn">返回发票列表</button>
        <button class="view-btn" @click="handleView">查看发票</button>
      </view>
    </view>
  </view>
</template>

<script setup>
import { ref, onMounted } from 'vue'
import { onLoad } from '@dcloudio/uni-app'
import CustomNavbar from '@/components/CustomNavbar.vue'

const navBarHeight = ref(88)
const invoiceAmount = ref('')

onLoad((options) => {
  if (options.amount) {
    invoiceAmount.value = options.amount
  }
})

onMounted(() => {
  const windowInfo = uni.getWindowInfo()
  const statusBarHeight = windowInfo.statusBarHeight || 0
  navBarHeight.value = statusBarHeight + 44
})

const handleReturn = () => {
  // 返回发票列表页面
  uni.navigateBack({
    delta: 3
  })
}

const handleView = () => {
  // 查看发票详情
  uni.showToast({
    title: '查看发票功能',
    icon: 'none',
    duration: 2000
  })
  // 这里可以跳转到发票详情页面
}
</script>

<style scoped>
.invoice-completed-page {
   
  position: relative;
  z-index: 1;
  background: rgba(246, 246, 246, 1);
}

.page-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  z-index: -1;
  pointer-events: none;
  object-fit: cover;
}

.gradient-bg {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 1;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.4);
}

.page-content {
  position: relative;
  z-index: 2;
  padding: 40rpx 32rpx;
  padding-bottom: 200rpx;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200rpx);
}

/* 成功状态 */
.success-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  flex: 1;
}

.success-icon {
  width: 200rpx;
  height: 200rpx;
  border-radius: 50%;
  background: rgba(78, 138, 254, 1);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 40rpx;
  box-shadow: 0px 8rpx 16rpx rgba(78, 138, 254, 0.3);
}

.checkmark {
  color: rgba(255, 255, 255, 1);
  font-size: 120rpx;
  font-weight: 700;
  line-height: 1;
}

.success-message {
  color: rgba(51, 51, 51, 1);
  font-family: HarmonyOS Sans SC;
  font-size: 32rpx;
  font-weight: 500;
  line-height: 38rpx;
}

/* 底部按钮 */
.button-group {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  display: flex;
  gap: 24rpx;
  padding: 32rpx;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20rpx);
  z-index: 100;
  box-shadow: 0 -4rpx 20rpx rgba(0, 0, 0, 0.05);
}

.return-btn,
.view-btn {
  flex: 1;
  height: 88rpx;
  border-radius: 44rpx;
  font-family: HarmonyOS Sans SC;
  font-size: 32rpx;
  font-weight: 500;
  line-height: 88rpx;
  text-align: center;
  border: none;
}

.return-btn {
  background: rgba(255, 255, 255, 1);
  color: rgba(78, 138, 254, 1);
  border: 2rpx solid rgba(78, 138, 254, 1);
}

.view-btn {
  background: rgba(78, 138, 254, 1);
  color: rgba(255, 255, 255, 1);
}

.return-btn::after,
.view-btn::after {
  border: none;
}

.return-btn:active,
.view-btn:active {
  opacity: 0.8;
}
</style>

